/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import Model.Gates.Gate;
import Model.Gates.Oscilloscope;
import java.awt.Dimension;
import java.awt.Point;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;

/**
 *
 * @author bg
 */
public class OscilloscopeView extends AbstractElementView {

    Oscilloscope osc;
    ArrayList<Boolean> memory;

    public OscilloscopeView(Oscilloscope osci, Point position) {

        inputs = new ArrayList<Point>();

        try {
            img = ImageIO.read(getClass().getResource("Images/osc.png"));
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Nincsen oscilloscope kép!");
        }
        this.osc = osci;
        this.position = position;
        this.preferredImageSize = new Dimension(30, 64);
        for (int i = Math.round(64 / (osc.getMaxInput() + 1)); i < 60; i += Math.round(64 / (osc.getMaxInput() + 1))) {
            inputs.add(new Point(position.x, position.y + i));
        }


    }

    void tick() {
        memory = osc.getMemory();
    }

    ArrayList<Boolean> getMemory() {
        memory = osc.getMemory();
        return memory;
    }

    

    @Override
    Gate getGate() {
        return osc;
    }
}
